{% extends 'base.html' %}

{% block title %}Mis cuestionarios.{% endblock %}
{% block head %}<script type ="text/javascript" src="/javascript/prototype.js"></script>{% endblock %}
{% block body %}
        <h3>Cuestionarios</h3>
        <form id = "cuestionario" action=".">
            <table>
                <tr><th>Preguntas:</th></tr>
                <tr><td><span id = "texto_pregunta">{{ question_text|escape }}</span></td></tr>
                <tr><th>Respuestas:</th></tr>
                    {% for a in answers%}
                        <tr><td><input type = "radio" name = "answers" value = "{{ a.0 }}" checked="checked"/>{{ a.1|escape }}</td></tr>
                    {% endfor %}
            </table>
            <p>
                <input type="hidden" name="question" value="{{ question_id }}"/>
                <input type="hidden" name="form" value="{{ form_id }}"/>
            </p>      
        </form>
            <p><span id = "contestar"><a href="#" 
               onclick="new Ajax.Request('/peticion_ajax/', 
                                        { parameters: $('cuestionario').serialize(),
                                              onFailure: function(){
                                                  },
                                              onSuccess: function(transport){
                                                    $('contestar').update(transport.responseText);
                                                  }
                                                 });">Contestar</a></span></p>
        <p><span id ="correccion"></span></p>
	<p>No uses el botón de atrás de tu navegador <br /> Regresar a <a href="/view_forms/" >mis cuestionarios</a>.</p>
{% endblock %}
